package com.cy.pj.framework.excel.util;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.cy.pj.sys.entity.SysDept;

public class SysdeptConverter implements Converter<SysDept> {
    @Override
    public Class<SysDept> supportJavaTypeKey() {
        return SysDept.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return null;
    }

    @Override
    public SysDept convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        SysDept sysDept = new SysDept();
         sysDept.setName(cellData.getStringValue());
        return sysDept;
    }

    @Override
    public CellData convertToExcelData(SysDept sysDept, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        return new CellData<>(sysDept.getName());
    }
}
